#pragma once
#include "Datastruct.h"


class CFIghterFace: public AnimaObj{ };


#define ICONS_PER_LINE 6
#define ICONS_INTERVAL 5

class SelectionSystem
{
private://Bkgnd
	HBITMAP hBm; 
	int BkW,BkH;
	int IconsPerLine;

	void LoadBkgnd();
	void UnloadBkgnd();

private:	//Icons and Faces
	int Lines ;
	HBITMAP FighterIcon[nFtrObj];
	int StartX, StartY;
	int IconW, IconH;
	HBITMAP IconsLayout;

	CFIghterFace FtrFace[nFtrObj];

	void MakePreArragedIconsLayout();
	void LoadIcons();
	void UnloadIcons();
	void LoadFaces();
	void UnloadFaces();
	void DrawIcons();
	void DrawFaces();

private:	//Frames
	HBITMAP Frame[2];
	POSITION FramePos[2]; //drawing position in pixel
	POSITION SelectPos[2]; //position of two frame 1,1  1,2  1,3 ...
	int FrameW, FrameH;

	void DrawSelection();

private://key input data
	BYTE LastMovement[2];
	bool Selected[2];
	void SetSelectPosByInput();

private:
		static const int nP = 2; //other is human or computer, but anyhow, there always 2 players.

public:
	BYTE SelectedFighterID[2];
	bool PlayerSelected();

	void Draw();
	void Reset();
	void LoadAll();
	void UnloadAll();
	SelectionSystem( );
};
